import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.Method;

public class Main {
    public static void main(String[] args) {
        Class<?> clazz= UserManager.class;
        if(clazz.isAnnotationPresent(Feature.class)){
            Feature feature = clazz.getAnnotation(Feature.class);
            System.out.println("Processing feature: "+feature.name());
            System.out.println("Description: "+feature.description());

            Method[] methods = clazz.getDeclaredMethods();
            for (Method method : methods) {
                if(method.isAnnotationPresent(SubFeature.class)){
                    SubFeature subFeature = method.getAnnotation(SubFeature.class);
                    System.out.println("  Processing sub-feature: "+subFeature.name());
                    System.out.println("  Description: "+subFeature.description());
                }else {
                    System.out.println("  Skipping non-sub-feature method: "+method.getName());
                }
            }
        }
    }
}

// 定义 @Feature 注解
@Retention(RetentionPolicy.RUNTIME)
@interface Feature {
    String name();
    String description();
}

// 定义 @SubFeature 注解
@Retention(RetentionPolicy.RUNTIME)
@interface SubFeature {
    String name();
    String description();
}

@Feature(name = "UserManagement", description = "Handles user management tasks")
class UserManager {

    @SubFeature(name = "AddUser", description = "Adds a new user to the system")
    public void addUser(String userName) {
        System.out.println("User " + userName + " added.");
    }

    @SubFeature(name = "RemoveUser", description = "Removes a user from the system")
    public void removeUser(String userName) {
        System.out.println("User " + userName + " removed.");
    }

    public void updateUser(String userName) {
        System.out.println("User " + userName + " updated.");
    }
}
